﻿using System;
using System.Collections.Generic;
using System.Text;

namespace gencode.btc
{
    class Helper
    {
        public static string GetWif(byte[] prikey)
        {
            NBitcoin.Key key = new NBitcoin.Key(prikey);
            var wif = key.GetWif(NBitcoin.Network.Main).ToWif();
            return wif;

        }
        public static string GetAddr(byte[] prikey)
        {
            NBitcoin.Key key = new NBitcoin.Key(prikey);
            var addr = key.ScriptPubKey.GetDestinationAddress(NBitcoin.Network.Main).ToString();
            return addr;
        }
        public static string GetUCAddr(byte[] prikey)
        {
            NBitcoin.Key keyuc = new NBitcoin.Key(prikey, -1, false);
            var addr = keyuc.ScriptPubKey.GetDestinationAddress(NBitcoin.Network.Main).ToString();
            return addr;
        }
        public static string GetAddrHex(byte[] prikey)
        {
            NBitcoin.Key key = new NBitcoin.Key(prikey);
            var hashhex = key.ScriptPubKey.ToHex();
            return hashhex;
        }
        public static string GetUCAddrHex(byte[] prikey)
        {
            NBitcoin.Key key = new NBitcoin.Key(prikey, 01, false);
            var hashhex = key.ScriptPubKey.ToHex();
            return hashhex;
        }

    }
}
